/*
 *  Copyright 2008 Mark Ashworth <javameme@gmail.com>.
 * 
 *  Licensed under the GNU General Public License v3 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 * 
 *       http://www.gnu.org/licenses/gpl-3.0.html
 * 
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 */
package xperiment.metaphor.model;

import xperiment.metaphor.model.entity.Gender;
import xperiment.metaphor.model.entity.PopulationGroup;
import metaphor.persistence.filter.Query;
import metaphor.persistence.filter.SimpleExpression;

/**
 * A collection of standard well-defined queries
 * @author Mark Ashworth <javameme@gmail.com>
 * @version 1.0.0
 */
public enum Queries {
    GENDER_MALE(Query.forClass(Gender.class).add(SimpleExpression.ilike("name", "MALE"))),
    GENDER_FEMALE(Query.forClass(Gender.class).add(SimpleExpression.ilike("name", "FEMALE"))),
    
    POPULATION_GROUP_WHITE(Query.forClass(PopulationGroup.class).add(SimpleExpression.ilike("name", "WHITE"))),
    POPULATION_GROUP_BLACK(Query.forClass(PopulationGroup.class).add(SimpleExpression.ilike("name", "BLACK"))),
    POPULATION_GROUP_COLOURED(Query.forClass(PopulationGroup.class).add(SimpleExpression.ilike("name", "COLOURED"))),
    POPULATION_GROUP_ASIAN(Query.forClass(PopulationGroup.class).add(SimpleExpression.ilike("name", "ASIAN"))),
    ;
    private final Query query;
    
    private Queries(Query query) {
        this.query = query;
    }
    
    /**
     * Returns the query
     * @return Query
     */
    public Query getQuery() {
        return this.query;
    }
}
